package 图形界面;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class changeSDorm {
    //图二十一框架
    private JFrame frame21=new JFrame("更改面板");
    private JLabel lal3=new JLabel("请输入你要改变宿舍床位的学生名字");
    private JTextField jtf1=new JTextField(20);
    private JLabel lal4=new JLabel("请输入要更改的栋号");
    private JTextField jtf2=new JTextField(20);
    private JLabel lal5=new JLabel("请输入要更改的宿舍号");
    private JTextField jtf3=new JTextField(20);
    private JLabel lal6=new JLabel("请输入要更改的床位");
    private JTextField jtf4=new JTextField(20);
    private JButton but9=new JButton("确认");

    //图二十二框架
    private JFrame frame22=new JFrame("成功");
    private JLabel laa=new JLabel("已经成功更改");

    public changeSDorm() {
        frame21.setSize(550, 400);
        frame21.setLocation(500, 200);
        frame21.setLayout(null);
        lal3.setBounds(50,60,200,20);
        jtf1.setBounds(300,60,200,20);
        lal4.setBounds(50,100,200,20);
        jtf2.setBounds(300,100,200,20);
        lal5.setBounds(50,140,200,20);
        jtf3.setBounds(300,140,200,20);
        lal6.setBounds(50,180,200,20);
        jtf4.setBounds(300,180,200,20);
        but9.setBounds(170,220,200,20);
        frame21.add(lal3);
        frame21.add(jtf1);
        frame21.add(lal4);
        frame21.add(jtf2);
        frame21.add(lal5);
        frame21.add(jtf3);
        frame21.add(lal6);
        frame21.add(jtf4);
        frame21.add(but9);
        but9.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                frame21.setVisible(false);
                String a=jtf1.getText();
                String b=jtf2.getText();
                String c=jtf3.getText();
                String d=jtf4.getText();
                try {
                    JDBC1.Change1(a,b,c,d);
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
                frame22.setSize(550,400);
                frame22.setLocation(500, 200);
                frame22.add(laa);
                frame22.setVisible(true);
                frame22.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            }
        });
        frame21.setVisible(true);
        frame21.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
